<?php
/**
 * ReportController.class.php
 * 报表控制器
 * 
 * @author 	王中艺	<wangzy_smile@qq.com>
 * @date 	2017-03-01
 */
namespace Admin\Controller;

class ReportController extends BaseController {
	/**
	 * 收入报表统计
	 * @param   $date_start 起始时间
	 * @param   $date_end  结束时间
	 * @return  list [<description>]
	 */
	function getIncome(){
		$timeS 	= $this->iInfo['date_start'] ? strtotime($this->iInfo['date_start']) : strtotime('-10 day');
		$timeE 	= $this->iInfo['date_end'] ? strtotime($this->iInfo['date_end'].' +1 day') : time();

		$Report 	= new \Admin\Util\Report();
		$data 	= $Report->getIncome($timeS, $timeE);
		$this->outOInfo($data);
	}

	/**
	 * 课程报表统计
	 * @param   $date_start 起始时间
	 * @param   $date_end  结束时间
	 * @return  list [<description>]
	 */
	function getCourse(){
		$timeS 	= $this->iInfo['date_start'] ? strtotime($this->iInfo['date_start']) : strtotime('-10 day');
		$timeE 	= $this->iInfo['date_end'] ? strtotime($this->iInfo['date_end'].' +1 day') : time();

		$Report 	= \Admin\Util\Report::getInstance();
		$data 	= $Report->getCourse($timeS, $timeE);
		$this->outOInfo($data);
	}

	/**
	 * 购物车报表统计
	 * @param 	$date_start 	起始时间
	 * @param 	$date_end 	结束时间
	 * @return 	$data 	json
	 */
	function getShopCart(){
		$timeS 	= $this->iInfo['date_start'] ? strtotime($this->iInfo['date_start']) : strtotime('-10 day');
		$timeE 	= $this->iInfo['date_end'] ? strtotime($this->iInfo['date_end'].' +1 day') : time();

		$Report 	= \Admin\Util\Report::getInstance();
		$data 	= $Report->getShopCart($timeS, $timeE);
		$this->outOInfo($data);
	}

}